package com.example.tkserver.controller;

import com.example.tkserver.entity.Answer;
import com.example.tkserver.service.interfaces.AnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/answer")
public class AnswerController {

    @Autowired
    AnswerService answerService;

    @RequestMapping("/getAnswerNum")
    public int getAnswerNum(int qid){
        return answerService.getAnswerNum(qid);
    }

    @RequestMapping("/getAnswersBetween")
    public List<Answer> getAnswersBetween(int qid,int start,int end){
        return answerService.getAnswersBetween(qid,start,end);
    }

    @RequestMapping("/pushAnswer")
    public Answer pushAnswer(@RequestBody Answer answer){
        return answerService.pushAnswer(answer);
    }
}
